#pragma once
//#include <d3d9.h>
//#include <d3dx9.h>
//#include <dxerr.h>

namespace Renderer
{
	class Graphics;

	class WorldPosition
	{
	protected:
		bool isBillboard;

		float posX, posY, posZ;
		float rotX, rotY, rotZ;
		float scaleX, scaleY, scaleZ;

		D3DXMATRIX worldMatrix;
		D3DXMATRIX scaleMatrix;
		D3DXMATRIX rotationMatrix;
		D3DXMATRIX translationMatrix;
		D3DXMATRIX* combineMatrix1;
		D3DXMATRIX* combineMatrix2;

	public:
		WorldPosition();

		D3DXMATRIX* GetMatrix(Graphics * graphics = NULL);
		void SetCombineMatrix1(D3DXMATRIX* matrix = NULL);
		void SetCombineMatrix2(D3DXMATRIX* matrix = NULL);

		bool Copy(WorldPosition * destPos);

		void Move(float posX, float posY, float posZ);
		void MoveRel(float addX, float addY, float addZ);

		void Rotate(float rotX, float rotY, float rotZ);
		void RotateRel(float addX, float addY, float addZ);

		void Scale(float scaleX, float scaleY, float scaleZ);
		void ScaleRel(float addX, float addY, float addZ);

		void Update(Graphics* graphics = NULL);
		void EnableBillboard(bool enable = true);

		float GetXPos() const;
		float GetYPos() const;
		float GetZPos() const;
		float GetXRotation() const;
		float GetYRotation() const;
		float GetZRotation() const;
		float GetXScale() const;
		float GetYScale() const;
		float GetZScale() const;
	};

}
